<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>出入库信息管理</title>
<meta name="decorator" content="default" />
<script src="${ctxStatic}/common/change/change.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
    	initVaccName(bsVaccineOrder.companyCode,bsVaccineOrder.vaccineId);
    	initVaccCompanyName(bsVaccineOrder.companyCode);
    	$(".vaccineCompany").change(function(){
    		var vaccId = $(this).val();
    		initCompanyName($(this).val());
    		if(vaccId == ""){
    			initVaccCompanyName("");
    		}
    	});
    	
    	$(document).on("click","#btnReset",function(){
    		$("#vaccineId").val("").select2();
    		$("#batchType").val("").select2();
    		$("#companyCode").val("").select2();
    		$("#orderNo").val("");
    		$("#batchno").val("");
    		$("#type").val("").select2();
    		$("#startDate").val("");
    		$("#endDate").val("");
    	});
    })
    var bsVaccineOrder = JSON.parse('${fns:toJson(bsVaccineOrder)}');
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}

	function choose() {
		//获取所有的选择列
		var data = [];
		debugger;
		$("#contentTable").find(":checkbox:checked").each(function(key, value) {
			var order_id = $(this).val();
			data.push(order_id);
		});
		if (data.length != 1) {//单条记录限制
			layer.msg("请选择一条记录", {
				"icon" : 7,
				"time" : 1000
			});
			return;
		}
		parent.layer.closeAll();
		parent.getOrder(data);
	}
</script>
<style type="text/css">
body{
	padding:10px;
}
</style>
</head>
<body>
	<%-- <ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/order/bsVaccineOrder/getReList">出入库信息列表</a></li>
	</ul> --%>
	<form:form id="searchForm" modelAttribute="bsVaccineOrder" action="${ctx}/order/bsVaccineOrder/getReList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden"
			value="${page.pageSize}" />
		<table class="table table-bordered">
			<tr>
			    <th>疫苗/注射器：</th>
				<td>
					<form:select path="batchType" id="batchType" class="span2 minWidth">
						<form:option value="" label="--请选择--"/>
						<form:options items="${fns:getDictList('batch_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select> 
				</td>
				<th>疫苗类型：</th>
				<td>
				    <form:select path="cType" class="span2 minWidth">
						<form:option value="" label="--请选择--" />
						<form:options items="${fns:getDictList('bs_vaccineInfo_type')}"
							itemLabel="label" itemValue="value" htmlEscape="false" />
					</form:select>
				</td>
				
				<th>疫苗批号：</th>
				<td>
				     <input type="text" name="batchno" id="batchno" class="input-medium" value="${bsVaccineOrder.batchno}"/>
				</td>
			</tr>
			<tr>
				<th>疫苗名称：</th>
				<td> 
				    <form:select path="vaccineId" class="span2 minWidth vaccineCompany">
						<form:option value="" label="--请选择--" />
					</form:select>
				</td>
				<th>生产企业：</th>
				<td>
				    <form:select path="companyCode" class="span2 minWidth changeCompany vaccCompanyName">
						<form:option value="" label="--请选择--" />
					</form:select>
				</td>
				<th>出入库单号：</th>
				<td>
				     <input type="text" name="orderNo" id="orderNo" class="input-medium" value="${bsVaccineOrder.orderNo}"/>
				</td>
			</tr>
			<tr>
				<th>出入库开始日期:</th>
				<td>
		            <input name="startDate" id="startDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
				    value="<fmt:formatDate value="${bsVaccineOrder.startDate}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" />
				</td>
				<th>出入库截至日期:</th>
				<td colspan="3">
				    <input name="endDate" id="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
				    value="<fmt:formatDate value="${bsVaccineOrder.endDate}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" />
				</td>
			</tr>

		</table>

		<ul class="ul-form">
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" /></li>
			<li class="btns"><input id="btnReset" class="btn btn-primary" type="button" value="重置" /></li>
			<li class="btns"><input onclick="choose()" class="btn btn-primary" type="button" value="确认选择" /></li>
		</ul>
	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th></th>
				<th>操作</th>
				<th>类型</th>
				<th>订单号</th>
				<th>审核情况</th>
				<th>属性</th>
				<th>出入库日期</th>
				<th>供货单位</th>
				<th>收货单位</th>
				<th>录入单位</th>
			</tr>
		</thead>
		<tbody id="check">
			<c:forEach items="${page.list}" var="bsVaccineOrder">
				<tr>
					<td><span><input type="checkbox"  value="${bsVaccineOrder.id}"></span>
					</td>
					<td>
					    <c:if test="${bsVaccineOrder.orderType==1}">
							<a  href="${ctx}/order/bsVaccineOrder/veiwForm?id=${bsVaccineOrder.id}">查看</a>
						</c:if>
					</td>
					<td>
					    ${fns:getDictLabel(bsVaccineOrder.orderType, "bs_order_ordertype", "")}
					</td>
					<td>
					    ${bsVaccineOrder.orderNo}
					</td>
					<td>
					    ${fns:getDictLabel(bsVaccineOrder.orderStatus, "bs_order_status", "")}
					</td>
					<td>${fns:getDictLabel(bsVaccineOrder.cType, "bs_vaccine_type", "")}</td>
					<td>
					    <fmt:formatDate value="${bsVaccineOrder.outboundDate}"   pattern="yyyy-MM-dd" /></td>
					<td>
					    ${bsVaccineOrder.supplyorgName}
					</td>
					<td>
					    ${bsVaccineOrder.receiveorgName}
					</td>
					<td>
					    ${bsVaccineOrder.createorgName}
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>